A. Field of the Invention
This invention relates to data processing systems, and more particularly to remote method invocations on remote servers. Even more specifically, this invention relates to a method and system for identifying remote methods on a server machine using hash values.
B. Related Art
Distributed systems typically comprise multiple machines, such as computers and related peripheral devices, connected in a network, for example, a Local Area Networks (LAN), Wide Area Network (WAN), or the Internet. Distributed systems generally require that computational entities (e.g., applications, programs, applets, etc.) running in different address spaces, potentially on different machines, be able to communicate.
For a basic communication mechanism, distributed object oriented systems utilize a Remote Procedure Call (RPC) mechanism referred to as Remote Method Invocation (RMI). RMI facilitates application-level communication between xe2x80x9cobjectsxe2x80x9d residing in different address spaces. In object oriented systems, a xe2x80x9cclassxe2x80x9d provides a template for the creation of xe2x80x9cobjectsxe2x80x9d (which represent items or instances manipulated by the system) having characteristics of that class. The term template denotes that the objects (i.e., data items) in each class, share certain characteristics or attributes determined by the class such as its methods. Objects are typically created dynamically during system operation. Methods associated with a class are generally invoked (i.e., caused to operate) on the objects of the same class. RMI is the action of invoking a method of a remote object. In response to the invocation of a method of a remote object using RMI, a lower level communications process causes the invoked method to be executed on the remote object.
The Java(trademark) runtime system, which is designed to implement applications written in the Java(trademark) object oriented programming language, supports a specific Java(trademark) RMI Application Program Interface (API). This API is explained in, for example, a document entitled xe2x80x9cRemote Method Invocation Specification,xe2x80x9d Sun Microsystems, Inc. (1997), which is available via universal resource locator(URL)http://www javasoft.com/products/jdk/1.1/docs/guide/rmi/spec/rmiTOC.doc.html, and is incorporated herein by reference. The Java(trademark) language is described in many texts, including one that is entitled xe2x80x9cThe Java Language Specificationxe2x80x9d by James Gosling, Bill Joy, and Guy Steele, Addison-Wesley, 1996. Java and all Java-based trademarks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries.
Java RMI assumes a homogeneous environment of the specialized Java runtime system, and therefore Java RMI takes advantage of a specialized object model for the Java language whenever possible. In the Java(trademark) distributed object model, a remote object is one that has methods that can be invoked from another runtime system, potentially on a different machine. An object of this type is described by one or more remote interfaces code written in the Java language that specify the methods of the remote object.
The Java runtime system keeps track of all remote objects referenced by computational entities executing through a local virtual machine (VM). The Java(trademark) VM (JVM) is an abstract computing machine of the runtime system that receives instructions from programs in the form of bytecodes and that interprets these bytecodes by dynamically converting them into a form for execution, such as object code, and executing them. The JVM is described in detail in a text entitled xe2x80x9cThe Java Virtual Machine Specificationxe2x80x9d, by Tim Lindholm and Frank Yellin, Addison Wesley, 1996.
In Java RMI, a client, while processing a program, can remotely initiate processing by a server computer of methods in connection with certain xe2x80x9cparameterxe2x80x9d information provided by the client. After the server has processed the procedure, it will provide results of its processing to the client, which the client may thereafter use in its processing operations. Typically in such RMI calls, the client will make use of a local xe2x80x9cstubxe2x80x9d which, when called, transfers the request to the server which implements the particular method, obtains the results and provides them back to the client.
Conventionally, when a client calls a method on a remote object containing a list of methods, the method is identified by a string name or a sequence number identifying the selected method. However, identifying a method by its string name can create false identification of a remote method because the remote object may have more than one -method with the same string name. Such methods are said to be xe2x80x9coverloaded.xe2x80x9d Although methods may have the same string name, overloaded methods with duplicate same string names typically take different parameter types. For instance, suppose a remote object, using the Java programming language, has the following two methods:
If a client seeks to invoke one of these two methods, the string name xe2x80x9clookupPhonexe2x80x9d alone does not enable the remote object to determine the correct method to be invoked because more than one method with that name exist.
Another conventional approach for identifying a remote method is to put the methods in alphabetical order and number them. Suppose a remote object implements the following two methods:
The numbering of the methods may be represented as follows:
1. lookupPhone
2. storePhone
When a client wants to invoke a method, it simply sends the number corresponding to the method in the method invocation instruction. If, however, new methods are added to the remote object such that it appears as follows:
the new numbering of the methods would be:
1. lookupAddress
2. lookupPhone
3. storeAddress
4. storePhone
Hence, the numbers corresponding to each method have changed. Thus, existing clients that continue to use old stubs using the old numbering would invoke the wrong methods.
Accordingly, it is desirable to provide a system that uniquely identifies the methods of remote objects for RMI.
The present invention satisfies this and other desires by providing a method and system for identifying the methods of remote objects using hash values.
A method in a data processing system for invoking a remote methods comprises the steps of providing a hash value uniquely identifying a remote method, sending the hash value in response to an instruction to invoke the remote method, and invoking the remote method based on the hash value. The method further includes the step of locating the remote method in a mapping table using the hash value.
Apparatus and systems are also provided for carrying out methods consistent with the present invention.
The advantages accruing to the present invention are numerous. For example, methods and systems consistent with the present invention identify unique remote methods for invocation, thus avoiding false identification of incorrect remote methods. Furthermore, this identification can be performed even if two or more methods have the same string name, or the methods use a changing numbering system.
Although a long string such as the method name combined with a parameter type list could be used to more precisely identify a remote method, such an identifier would be cumbersome. The use of hash values further creates greater efficiency by eliminating the need for long strings to more precisely identify remote methods. Additionally, it allows the server to perform more efficiently because the server can more efficiently manipulate and compute the integer numbers than the strings.
It is therefore, desirable to provide a method and apparatus to uniquely identify remote methods using hash values.